<!--

var cookieprefix="GaHedotCom";

var IsUserLogin=0;

var ISMouseOnRandomBonusDiv=false;
var ISRandomBonusRunning=false;

img3 = new Image(16, 16);  
img3.src="http://www.gahe.com/images/orange/ajax-loader_header.gif";

function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}

function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime() + seconds);
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
	+ (expires ? '; expires=' + expires.toGMTString() : '')
	+ (path ? '; path=' + path : '/')
	+ (domain ? '; domain=' + domain : '')
	+ (secure ? '; secure' : '');
}



function CheckLogin(){
	var LoginStats=getcookie(cookieprefix+"_logged_in");
	if(LoginStats==1) IsUserLogin=1;
	else IsUserLogin=0;
}


function ShowLoginOrLogout(){
	//console.log(IsUserLogin);
	if(IsUserLogin==1){
		username=getcookie(cookieprefix+"_username");
		$('#loginorlogout').html("<a href='/mygames' title='My Favourite Games' rel='nofollow'><img src='/images/orange/favourites-2.jpg'></a> <a href='#' onClick=\"LogOut();return false;\" title='Logout' rel='nofollow'><img src='/images/orange/logout-2.jpg'></a>");
	}else{
		$('#loginorlogout').html("<span><a href='#' onclick='ShowRegisterModal();return false;' title='Create an Accout for Free' rel='nofollow'><img src='/images/orange/signup-2.jpg'></a></span><span><a href='#' onclick='ShowLoginModal();return false;' title='Login to Gahe' rel='nofollow'><img src='/images/orange/login-2.jpg'></a></span>");
	}	
}

function LogOut(){
	$('#loginorlogout').html("<div style='margin:7px 0 0 0'><img align='absmiddle' src='/images/orange/ajax-loader_header.gif'>&nbsp;Processing...</div>");
	$.ajax({  
		url: "http://www.gahe.com/logout.php",
		success: function(msg){  
			//console.log(msg);
			if(msg == 'ok')  {
				//$('#loginorlogout').html("you have logout successfully.");				
				UpdateUserStats();
			}
		}
	});	//end ajax	
	return false;	
}
		
function UpdateUserStats(){
	CheckLogin();
	ShowLoginOrLogout();	
}
function ShowRegisterModal(){
	UpdateUserStats();
	if(!IsUserLogin){
		ShowModal('/register',470,440,false,false);
	}
	return false;
}
function ShowLoginModal(){
	UpdateUserStats();
	if(!IsUserLogin){
		ShowModal('/login',470,440,false,false);return false;	
	}
	return false;
}

$(document).ready(function(){

	UpdateUserStats();
/*	
	$("span[id^='GameName-']").live("click",function(){
		 window.location=$(this).find("a").attr("href"); 
		 return false;
	});
*/	
	//$('#RandomBonusDiv').floatdiv({interval:10,step:1,startleft:0,startop:0});
	$("div[id^='Thumb-']").live("mouseenter", function () {  
    	thegameids=this["id"].split("-");
		thegameid=thegameids[1];
		TheGameNameOperateID="GameName-"+thegameids[1]+"-"+thegameids[2];
		TheGameRatingOperateID="GameRating-"+thegameids[1]+"-"+thegameids[2];
		
		$("#" + TheGameNameOperateID).show();
		$("#" + TheGameRatingOperateID).show();
		//console.log("mouse enter Thumb");
    }); 
	$("div[id^='Thumb-']").live("mouseleave", function () {  
    	thegameids=this["id"].split("-");
		thegameid=thegameids[1];
		$("#GameName-"+thegameids[1]+"-"+thegameids[2]).hide();
		$("#GameRating-"+thegameids[1]+"-"+thegameids[2]).hide();
		//console.log("mouse leave Thumb");
    });

	$(function() {
    	$('span.GameRating').stars();
	});
	$.fn.stars = function() {
		return $(this).each(function() {
			// Get the value
			var val = parseFloat($(this).html());
			// Make sure that the value is in 0 - 5 range, multiply to get width
			if($.isNumeric(val)){
				var size = Math.max(0, (Math.min(5, val))) * 16;
				// Create stars holder
				var $span = $('<span />').width(size);
				// Replace the numerical value with stars
				$(this).html($span);
			}
		});
	}

});
-->